package presenter;

import java.util.Observer;

import bean.messge_bean.MesgeBeans;
import interfaces.ISysMesgenance;
import responsitory.SYstemMessgepomsitory;
import util.volley.ICompleteListener;
import util.volley.ResultEntity;

/**
 * Created by itboye on 2016/12/10.
 */

public class SysTemPresenter extends BasePresenter implements ISysMesgenance<MesgeBeans> {


    //消息
    public static final String Secret_success = SysTemPresenter.class.getName()
            + "_Secret_success";
    public static final String Secret_fail = SysTemPresenter.class.getName()
            + "_Secret_fail";


    //消息
    public static final String Messge_success = SysTemPresenter.class.getName()
            + "_Messge_success";
    public static final String Messge_fail = SysTemPresenter.class.getName()
            + "_Messge_fail";



    //消息
    public static final String MessgeRE_success = SysTemPresenter.class.getName()
            + "_MessgeRE_success";
    public static final String MessgeRE_fail = SysTemPresenter.class.getName()
            + "_MessgeRE_fail";

    //查看技能
    public static final String GetJineng_success = SysTemPresenter.class.getName()
            + "_GetJineng_success";
    public static final String GetJineng_fail = SysTemPresenter.class.getName()
            + "_GetJineng_fail";



    //维修可接单
    public static final String WeiXiuKejie_success = SysTemPresenter.class.getName()
            + "_WeiXiuKejie_success";
    public static final String WeiXiuKejie_fail = SysTemPresenter.class.getName()
            + "_WeiXiuKejie_fail";

    //接单
    public static final String MeetOrder_success = SysTemPresenter.class.getName()
            + "_MeetOrder_success";
    public static final String MeetOrder_fail = SysTemPresenter.class.getName()
            + "_MeetOrder_fail";


    //维修进行中
    public static final String Repair_success = SysTemPresenter.class.getName()
            + "_Repair_success";
    public static final String Repair_fail = SysTemPresenter.class.getName()
            + "_Repair_fail";

    //报价
    public static final String SetPrice_success = SysTemPresenter.class.getName()
            + "_SetPrice_success";
    public static final String SetPrice_fail = SysTemPresenter.class.getName()
            + "_SetPrice_fail";

    //设置初始支付密码
    public static final String SttringPay_success = SysTemPresenter.class.getName()
            + "_SttringPay_success";
    public static final String SttringPay_fail = SysTemPresenter.class.getName()
            + "_SttringPay_fail";

    //重置支付密码
    public static final String Chongzhimima_success = SysTemPresenter.class.getName()
            + "_Chongzhimima_success";
    public static final String Chongzhimima_fail = SysTemPresenter.class.getName()
            + "_Chongzhimima_fail";


    //账户余额
    public static final String Account_success = SysTemPresenter.class.getName()
            + "_Account_success";
    public static final String Account_fail = SysTemPresenter.class.getName()
            + "_Account_fail";

    /**
     * 维修记录
     */
    public static final String WeiXiuJilu_success = SysTemPresenter.class.getName()+ "_WeiXiuJilu_success";
    public static final String WeiXiuJilu_fail = SysTemPresenter.class.getName()+ "_WeiXiuJilu_fail";

    /**
     * 支持账号提现类型
     */
    public static final String BangdingType_success = SysTemPresenter.class.getName()+ "_BangdingType_success";
    public static final String BangdingType_fail = SysTemPresenter.class.getName()+ "_BangdingType_fail";



    /**
     * 支持账号提现账号列表
     */
    public static final String ZhangHaoList_success = SysTemPresenter.class.getName()+ "_ZhangHaoList_success";
    public static final String ZhangHaoList_fail = SysTemPresenter.class.getName()+ "_ZhangHaoList_fail";



    /**
     * 支持账号提现类型
     */
    public static final String ChongZhi_success = SysTemPresenter.class.getName()+ "_ChongZhi_success";
    public static final String ChongZhi_fail = SysTemPresenter.class.getName()+ "_ChongZhi_fail";


    /**
     * 支持账号提现类型
     */
    public static final String WEI_success = SysTemPresenter.class.getName()+ "_WEI_success";
    public static final String WEI_fail = SysTemPresenter.class.getName()+ "_WEI_fail";


    public static final String BANG_success = SysTemPresenter.class.getName()+ "_BANG_success";
    public static final String BANG_fail = SysTemPresenter.class.getName()+ "_BANG_fail";



    public static final String TIxian_success = SysTemPresenter.class.getName()+ "_TIxian_success";
    public static final String TIxian_fail = SysTemPresenter.class.getName()+ "_TIxian_fail";

    public static final String Wancheng_success = SysTemPresenter.class.getName()+ "_Wancheng_success";
    public static final String Wancheng_fail = SysTemPresenter.class.getName()+ "_Wancheng_fail";

    //删除绑定的账号
    public static final String delete_zhanghao_success = SysTemPresenter.class.getName()
            + "_delete_zhanghao_success";
    public static final String delete_zhanghao_fail = SysTemPresenter.class.getName()
            + "_delete_zhanghao_fail";



    /**
     * 订单
     */
    public static final String dingdan_success = SysTemPresenter.class.getName()
            + "_dingdan_success";
    public static final String dingdan_fail = SysTemPresenter.class.getName()
            + "_dingdan_fail";

    public SysTemPresenter(Observer observer) {
        super(observer);
    }

    @Override
    public void onSysmTemMeesge(String uid, String msgType, String pageIndex, String pageSize) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Messge_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Messge_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onSysmTemMeesge(uid, msgType, pageIndex, pageSize);
    }

    @Override
    public void onSysmTemMeesgeRes(String uid, String msgType, String pageIndex, String pageSize) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(MessgeRE_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(MessgeRE_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onSysmTemMeesgeRes(uid, msgType, pageIndex, pageSize);
    }

    @Override
    public void onGetJineng(String uid) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(GetJineng_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(GetJineng_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onGetJineng(uid);
    }

    @Override
    public void onWeixiuJie(String uid, String current_page, String per_page, String lng, String lat,String order) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(WeiXiuKejie_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(WeiXiuKejie_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onWeixiuJie(uid, current_page, per_page, lng, lat,order);
    }

    @Override
    public void onMeetOrder(String uid, String id) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(MeetOrder_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(MeetOrder_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onMeetOrder(uid, id);
    }

    @Override
    public void onRepair(String uid, String group_id) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Repair_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Repair_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onRepair(uid, group_id);
    }

    @Override
    public void onsetPrice(String uid, String id, double repair_price, double stuff_price) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SetPrice_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SetPrice_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onsetPrice(uid, id,repair_price,stuff_price);
    }

    /**
     * 设置初始支付密码
     * @param uid
     * @param news
     */
    @Override
    public void onSttringPayPwd(String uid, String news) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(SttringPay_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(SttringPay_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onSttringPayPwd(uid,news);
    }

    /**
     * 重置支付密码
     * @param uid
     * @param old
     * @param news
     */
    @Override
    public void onChongzhiPwd(String uid, String old, String news) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Chongzhimima_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Chongzhimima_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onChongzhiPwd(uid,old,news);
    }

    @Override
    public void onAccount(String uid) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Account_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Account_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onAccount(uid);
    }

    @Override
    public void onWeiXiuJiLu(String uid, String id,String repair_status, String current_page, String per_page) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(WeiXiuJilu_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(WeiXiuJilu_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onWeiXiuJiLu(uid,id,repair_status,current_page,per_page);
    }

    @Override
    public void onBangDinType() {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(BangdingType_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(BangdingType_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onBangDinType();
    }

    @Override
    public void onZhangHaoList(String uid) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(ZhangHaoList_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(ZhangHaoList_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onZhangHaoList(uid);
    }

    @Override
    public void onChongZhi(String uid, String money) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(ChongZhi_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(ChongZhi_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onChongZhi(uid,money);
    }

    @Override
    public void onSysTemMessge(String uid, String msgtype, String pageindex, String pagesize) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(WEI_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(WEI_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onSysTemMessge(uid, msgtype,pageindex,pagesize);
    }

    @Override
    public void onByWalletBind(String uid, String account, String account_type,String open_bank,String real_name) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(BANG_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(BANG_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onByWalletBind(uid, account,account_type,open_bank,real_name);
    }

    @Override
    public void onTixian(String uid, String money, String account_id) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(TIxian_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(TIxian_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onTixian(uid, money,account_id);
    }

    @Override
    public void onWieXiuWancheng(String uid, String id, String group_id) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Wancheng_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Wancheng_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onWieXiuWancheng(uid, id,group_id);
    }

    @Override
    public void oncheckSecret(String uid, String secret) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(Secret_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(Secret_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.oncheckSecret(uid, secret);
    }

    @Override
    public void onZhangDan(String uid, String current_page, String per_page) {
        ISysMesgenance<MesgeBeans> user = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(dingdan_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(dingdan_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        user.onZhangDan(uid, current_page,per_page);
    }
    @Override
    public void deleteZhangHao(String uid, String id) {
        ISysMesgenance<MesgeBeans> dingdan = new SYstemMessgepomsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(Tag_Success);
                        result.setEventType(delete_zhanghao_success);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(Tag_Error);
                        result.setEventType(delete_zhanghao_fail);
                        SysTemPresenter.this.setChanged();
                        SysTemPresenter.this.notifyObservers(result);

                    }
                });
        dingdan.deleteZhangHao(uid,id);
    }
}
